<?php  if (!defined('BASEPATH')) exit('No direct script access allowed');

include_once( BASEPATH . '/helpers/date_helper'.EXT);

function datetime_mysql($datetime='')
{
	if ($datetime!='') {
		$ary = explode(' ', $datetime);
		$date = $ary[0];
		$time = $ary[1];
		
		$subary = explode('/', $date);
		$day   = $subary[0];
		$month = $subary[1];
		$year  = $subary[2];
		return $year.'-'.$month.'-'.$day.' '.$time;	
	} else {
		return false;
	}
}

function datetime_show ($datetime='') {
	return date('d/m/Y h:i:s',strtotime($datetime));
}

function timedate_show ($datetime='') {
	return date('h:i:s d/m/Y',strtotime($datetime));
}

function date_mysql($date='')
{
	if ($date!='') {
		$ary = explode('/', $date);
		$day   = $ary[0];
		$month = $ary[1];
		$year  = $ary[2];
		return $year.'-'.$month.'-'.$day;	
	} else {
		return false;
	}
}

function date_show ($datetime='') {
	return date('d/m/Y',strtotime($datetime));
}
